<?php
class indexdao extends daobase {
	public function checkUserNumber($userNumber){
		$sql = "select id from user where user_number = '$userNumber'";
		$userid = $this->fetchit($sql);
		$userid = $userid[0][0];
		return $userid;
	}
	public function checkUserPwd($userNumber,$userPwd){
		$sql = "select * from user where user_number = '$userNumber' and user_pwd = '$userPwd'";
		$userInfo = $this->fetchit($sql);
		return $userInfo;
	}
	public function register($userNumber,$userNickName,$userPwd){
		$sql = "select id from user where user_number='$userNumber'";
		$check = $this->fetchit($sql);
		$check = $check[0][0];
		if ($check){
			return "exsit";
		}
		$sql = "insert into user(user_number,user_name,	user_pwd) values('$userNumber','$userNickName','$userPwd')";
		$add = $this->queryit($sql);
		if($add){
			return "ok";
		}
 		return "0";
	}
	public function getUser($userNumber,$userPwd){
		$sql  = "select * from user where user_number='$userNumber' and user_pwd='$userPwd'";
		$user = $this->fetchit($sql);
		$user = $user[0];
		return $user;
	}
	public function updateLoginTime($userId,$time){
		return $this->update('user','last_login_time',$time)
		->where("user.id='$userId'")
		->query();
	}
}
?>